﻿<nz-modal [(nzVisible)]="isVisible" [nzTitle]="modalTitle" [nzContent]="modalContent" [nzFooter]="modalFooter" (nzOnCancel)="handleCancel()">
  <ng-template #modalTitle>
    修改Category
  </ng-template>

  <ng-template #modalContent>
    <form nz-form [formGroup]="validateForm" *ngIf="active">
      <nz-form-item>
        <nz-form-label [nzSm]="6" [nzXs]="24" nzFor="name" nzRequired>
          <span>
             分类名称
            <i nz-icon nz-tooltip nzTitle="请输入分类名称" type="question-circle" theme="outline"></i>
          </span>
        </nz-form-label>
        <nz-form-control [nzSm]="14" [nzXs]="24">
          <input nz-input id="name" formControlName="name" [(ngModel)]="category.name" >
          <nz-form-explain *ngIf="validateForm.get('name').dirty && validateForm.get('name').errors">请输入分类名称!</nz-form-explain>
        </nz-form-control>
      </nz-form-item>
      <nz-form-item>
        <nz-form-label [nzSm]="6" [nzXs]="24" nzFor="parentId">
          <span>
            上级分类
            <i nz-icon nz-tooltip nzTitle="请选择上级分类" type="question-circle" theme="outline"></i>
          </span>
        </nz-form-label>
        <nz-form-control [nzSm]="14" [nzXs]="24">
          <nz-select  formControlName="parentId"  [(ngModel)]="category.parentId" nzAllowClear nzPlaceHolder="请选择上级分类">
            <nz-option *ngFor="let option of optionList" [nzValue]="option.value" [nzLabel]="option.label"></nz-option>
          </nz-select>
          <nz-form-explain *ngIf="validateForm.get('parentId').dirty && validateForm.get('parentId').errors">请选择上级分类!</nz-form-explain>
        </nz-form-control>
      </nz-form-item>
      <nz-form-item>
        <nz-form-label [nzSm]="6" [nzXs]="24" nzFor="keywords">
          <span>
             关键字
            <i nz-icon nz-tooltip nzTitle="请输入关键字" type="question-circle" theme="outline"></i>
          </span>
        </nz-form-label>
        <nz-form-control [nzSm]="14" [nzXs]="24">
          <textarea nz-input id="keywords" formControlName="keywords" rows="2" [(ngModel)]="category.keywords"></textarea>
          <nz-form-explain *ngIf="validateForm.get('keywords').dirty && validateForm.get('keywords').errors">请输入关键字!</nz-form-explain>
        </nz-form-control>
      </nz-form-item>
      <nz-form-item>
        <nz-form-label [nzSm]="6" [nzXs]="24" nzFor="orderNo">
          <span>
             排序
            <i nz-icon nz-tooltip nzTitle="请输入排序" type="question-circle" theme="outline"></i>
          </span>
        </nz-form-label>
        <nz-form-control [nzSm]="14" [nzXs]="24">
          <nz-input-number id="orderNo" formControlName="orderNo" [nzMin]="1" [(ngModel)]="category.orderNo" [nzStep]="1" [nzDisabled]="isDisabled"></nz-input-number>
          <nz-form-explain *ngIf="validateForm.get('orderNo').dirty && validateForm.get('orderNo').errors">请输入排序!</nz-form-explain>
        </nz-form-control>
      </nz-form-item>
    </form>
  </ng-template>

  <ng-template #modalFooter>
    <button nz-button nzType="default" (click)="handleCancel()">取消</button>
    <button nz-button type="submit" [nzType]="'primary'" (click)="handleSave()" [nzLoading]="isConfirmLoading">保存</button>
  </ng-template>
</nz-modal>
